From: Krinkle Date: Thu, 18 Nov 2010 22:04:22 +0000 (+0000) Subject: Follow-up on r76972, renaming files inside the folder accordingly X-Git-Tag: 1.31.0-rc.0~33824 X-Git-Url: http://git.cyclocoop.org/%22.%24match%5B1%5D.%22?a=commitdiff_plain;h=b83075a82478a83fa0326b36ac1f53c366f39501;p=lhc%2Fweb%2Fwiklou.git Follow-up on r76972, renaming files inside the folder accordingly --- diff --git a/resources/mediawiki.special/mediawiki.special.preferences.css b/resources/mediawiki.special/mediawiki.special.preferences.css new file mode 100644 index 0000000000..b6298a5749 --- /dev/null +++ b/resources/mediawiki.special/mediawiki.special.preferences.css @@ -0,0 +1,21 @@ +#mw-emailaddress-validity { + padding: 2px 1em; +} +body.ltr #mw-emailaddress-validity { + border-bottom-right-radius:0.8em; + border-top-right-radius:0.8em; +} +body.rtl #mw-emailaddress-validity { + border-bottom-left-radius:0.8em; + border-top-left-radius:0.8em; +} +#mw-emailaddress-validity.valid { + border: 1px solid #80FF80; + background-color: #C0FFC0; + color: black; +} +#mw-emailaddress-validity.invalid { + border: 1px solid #FF8080; + background-color: #FFC0C0; + color: black; +} diff --git a/resources/mediawiki.special/mediawiki.special.preferences.js b/resources/mediawiki.special/mediawiki.special.preferences.js new file mode 100644 index 0000000000..5df2a3c916 --- /dev/null +++ b/resources/mediawiki.special/mediawiki.special.preferences.js @@ -0,0 +1,127 @@ +/* + * JavaScript for Special:Preferences + */ + +$( '#prefsubmit' ).attr( 'id', 'prefcontrol' ); +$( '#preferences' ) + .addClass( 'jsprefs' ) + .before( $( '' ) ) + .children( 'fieldset' ) + .hide() + .addClass( 'prefsection' ) + .children( 'legend' ) + .addClass( 'mainLegend' ) + .each( function( i ) { + $(this).parent().attr( 'id', 'prefsection-' + i ); + if ( i === 0 ) { + $(this).parent().show(); + } + $( '#preftoc' ).append( + $( '
  • ' ) + .addClass( i === 0 ? 'selected' : null ) + .append( + $( '') + .text( $(this).text() ) + .attr( 'href', '#prefsection-' + i ) + .mousedown( function( e ) { + $(this).parent().parent().find( 'li' ).removeClass( 'selected' ); + $(this).parent().addClass( 'selected' ); + e.preventDefault(); + return false; + } ) + .click( function( e ) { + $( '#preferences > fieldset' ).hide(); + $( '#prefsection-' + i ).show(); + e.preventDefault(); + return false; + } ) + ) + ); + } ); + +// Lame tip to let user know if its email is valid. See bug 22449 +$( '#mw-input-emailaddress' ) + .keyup( function () { + if( $( "#mw-emailaddress-validity" ).length == 0 ) { + $(this).after( '' ); + } + var isValid = wfValidateEmail( $(this).val() ); + var class_to_add = isValid ? 'valid' : 'invalid'; + var class_to_remove = isValid ? 'invalid' : 'valid'; + $( '#mw-emailaddress-validity' ) + .text( isValid ? 'Looks valid' : 'Valid address required!' ) + .addClass( class_to_add ) + .removeClass( class_to_remove ); + } ); + +/** + * Validate a string as representing a valid e-mail address + * according to HTML5 specification. Please note the specification + * does not validate a domain with one character. + * + * FIXME: should be moved to a JavaScript validation module. + */ +wfValidateEmail = function( mailtxt ) { + if( mailtxt == '' ) { return null; } + + /** + * HTML 5 define a string as valid e-mail address if it matches + * the ABNF : + * 1 * ( atext / "." ) "@" ldh-str 1*( "." ldh-str ) + * With: + * - atext : defined in RFC 5322 section 3.2.3 + * - ldh-str : defined in RFC 1034 section 3.5 + * + * (see STD 68 / RFC 5234 http://tools.ietf.org/html/std68): + */ + + /** + * First, define the RFC 5322 'atext' which is pretty easy : + * atext = ALPHA / DIGIT / ; Printable US-ASCII + "!" / "#" / ; characters not including + "$" / "%" / ; specials. Used for atoms. + "&" / "'" / + "*" / "+" / + "-" / "/" / + "=" / "?" / + "^" / "_" / + "`" / "{" / + "|" / "}" / + "~" + */ + var rfc5322_atext = "a-z0-9!#$%&'*+-/=?^_`{|}—~" ; + + /** + * Next define the RFC 1034 'ldh-str' + * ::= | " " + * ::=